The argument must always be the current state.
GtkBorder margin, border, padding;
int min_width, min_height;
- gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &margin);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
+ gtk_style_context_get_margin (context, &margin);
+ gtk_style_context_get_border (context, &border);
+ gtk_style_context_get_padding (context, &padding);
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"min-width", &min_width,
"min-height", &min_height,
NULL);
GtkBorder margin, border, padding;
int min_width, min_height;
- gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &margin);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
+ gtk_style_context_get_margin (context, &margin);
+ gtk_style_context_get_border (context, &border);
+ gtk_style_context_get_padding (context, &padding);
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"min-width", &min_width,
"min-height", &min_height,
NULL);
&menu_x, &menu_y, &menu_width, &menu_height);
/* Hovered with right arrow */
- gtk_style_context_get (hoveredarrowmenuitem_context, gtk_style_context_get_state (hoveredarrowmenuitem_context),
+ gtk_style_context_get (hoveredarrowmenuitem_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
draw_style_common (hovermenuitem_context, cr, menu_x, menu_y, menu_width, menuitem1_height,
/* Left arrow sensitive, and right arrow insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height, menu_width, menuitem2_height,
&contents_x, &contents_y, &contents_width, &contents_height);
- gtk_style_context_get (arrowmenuitem_context, gtk_style_context_get_state (arrowmenuitem_context),
+ gtk_style_context_get (arrowmenuitem_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (arrowmenuitem_context, cr, G_PI / 2,
contents_x,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
- gtk_style_context_get (disabledarrowmenuitem_context, gtk_style_context_get_state (disabledarrowmenuitem_context),
+ gtk_style_context_get (disabledarrowmenuitem_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (disabledarrowmenuitem_context, cr, G_PI / 2,
/* Left check enabled, sensitive, and right check unchecked, insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height, menu_width, menuitem3_height,
&contents_x, &contents_y, &contents_width, &contents_height);
- gtk_style_context_get (checkmenuitem_context, gtk_style_context_get_state (checkmenuitem_context),
+ gtk_style_context_get (checkmenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (checkmenuitem_context, cr,
contents_x,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (checkmenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
- gtk_style_context_get (disabledcheckmenuitem_context, gtk_style_context_get_state (disabledcheckmenuitem_context),
+ gtk_style_context_get (disabledcheckmenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledcheckmenuitem_context, cr,
contents_x + contents_width - toggle_width,
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height + menuitem3_height + menuitem4_height,
menu_width, menuitem5_height,
&contents_x, &contents_y, &contents_width, &contents_height);
- gtk_style_context_get (radiomenuitem_context, gtk_style_context_get_state (radiomenuitem_context),
+ gtk_style_context_get (radiomenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (radiomenuitem_context, cr,
contents_x,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (radiomenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
- gtk_style_context_get (disabledradiomenuitem_context, gtk_style_context_get_state (disabledradiomenuitem_context),
+ gtk_style_context_get (disabledradiomenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledradiomenuitem_context, cr,
contents_x + contents_width - toggle_width,
query_size (trough_context, NULL, height);
query_size (slider_context, NULL, height);
- gtk_style_context_get (slider_context, gtk_style_context_get_state (slider_context),
+ gtk_style_context_get (slider_context,
"min-width", &slider_width, NULL);
draw_style_common (scrollbar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
query_size (button_box_context, NULL, height);
query_size (arrow_context, NULL, height);
- gtk_style_context_get (arrow_context, gtk_style_context_get_state (arrow_context),
+ gtk_style_context_get (arrow_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
- gtk_style_context_get (up_context, gtk_style_context_get_state (up_context),
+ gtk_style_context_get (up_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", icon_size, 0);
g_object_unref (pixbuf);
- gtk_style_context_get (down_context, gtk_style_context_get_state (down_context),
+ gtk_style_context_get (down_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", icon_size, 0);
attributes = _gtk_pango_get_default_attributes (attributes,
gtk_entry_get_layout (GTK_ENTRY (widget)));
attributes = _gtk_style_context_get_attributes (attributes,
- gtk_widget_get_style_context (widget),
- gtk_widget_get_state_flags (widget));
+ gtk_widget_get_style_context (widget));
return attributes;
}
attributes = _gtk_pango_get_default_attributes (attributes,
gtk_label_get_layout (GTK_LABEL (widget)));
attributes = _gtk_style_context_get_attributes (attributes,
- gtk_widget_get_style_context (widget),
- gtk_widget_get_state_flags (widget));
+ gtk_widget_get_style_context (widget));
return attributes;
}
attrib_set = _gtk_pango_get_default_attributes (NULL, text_cell->priv->layout);
attrib_set = _gtk_style_context_get_attributes (attrib_set,
- gtk_widget_get_style_context (widget),
- gtk_widget_get_state_flags (widget));
+ gtk_widget_get_style_context (widget));
return attrib_set;
}
if (uri && !g_slist_find_custom (priv->visited_links, uri, (GCompareFunc)strcmp))
{
GdkRGBA visited_link_color;
- GtkStateFlags state;
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (about));
gtk_style_context_save (context);
- state = gtk_style_context_get_state (context) | GTK_STATE_FLAG_VISITED;
- gtk_style_context_set_state (context, state);
- gtk_style_context_get_color (context, state, &visited_link_color);
+ gtk_style_context_set_state (context, gtk_style_context_get_state (context) | GTK_STATE_FLAG_VISITED);
+ gtk_style_context_get_color (context, &visited_link_color);
gtk_style_context_restore (context);
g_object_set (G_OBJECT (tag), "foreground-rgba", &visited_link_color, NULL);
GtkStateFlags state = gtk_widget_get_state_flags (GTK_WIDGET (about));
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (about));
- gtk_style_context_get_color (context, state | GTK_STATE_FLAG_LINK, &link_color);
- gtk_style_context_get_color (context, state | GTK_STATE_FLAG_VISITED, &visited_link_color);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state | GTK_STATE_FLAG_LINK);
+ gtk_style_context_get_color (context, &link_color);
+ gtk_style_context_set_state (context, state | GTK_STATE_FLAG_VISITED);
+ gtk_style_context_get_color (context, &visited_link_color);
+ gtk_style_context_restore (context);
buffer = gtk_text_buffer_new (NULL);
for (p = strings; *p; p++)
if (!attrs)
attrs = pango_attr_list_new ();
gtk_style_context_get (context,
- gtk_style_context_get_state (context),
"font", &font_desc,
NULL);
pango_attr_list_change (attrs, pango_attr_font_desc_new (font_desc));
context = gtk_widget_get_style_context (GTK_WIDGET (object));
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"-gtk-key-bindings", &array,
NULL);
if (array)
GtkBorder *week_padding)
{
GtkStyleContext * context;
- GtkStateFlags state;
GtkWidget *widget;
widget = GTK_WIDGET (calendar);
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
if (padding)
- gtk_style_context_get_padding (context, state, padding);
+ gtk_style_context_get_padding (context, padding);
if (day_padding)
{
gtk_style_context_save (context);
gtk_style_context_add_class (context, "day-number");
- gtk_style_context_get_padding (context, state, day_padding);
+ gtk_style_context_get_padding (context, day_padding);
gtk_style_context_restore (context);
}
{
gtk_style_context_save (context);
gtk_style_context_add_class (context, "day-name");
- gtk_style_context_get_padding (context, state, day_name_padding);
+ gtk_style_context_get_padding (context, day_name_padding);
gtk_style_context_restore (context);
}
{
gtk_style_context_save (context);
gtk_style_context_add_class (context, "week-number");
- gtk_style_context_get_padding (context, state, week_padding);
+ gtk_style_context_get_padding (context, week_padding);
gtk_style_context_restore (context);
}
}
cairo_save (cr);
- gtk_style_context_get_color (context, state, &color);
+ gtk_style_context_get_color (context, &color);
gdk_cairo_set_source_rgba (cr, &color);
cairo_set_line_width (cr, 1);
{
GtkBorder border;
GtkStyleContext *context;
- GtkStateFlags state;
g_return_if_fail (GTK_IS_CELL_AREA (area));
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (inner_area != NULL);
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_padding (context, state, &border);
+ gtk_style_context_get_padding (context, &border);
*inner_area = *cell_area;
{
GtkBorder border;
GtkStyleContext *context;
- GtkStateFlags state;
g_return_if_fail (GTK_IS_CELL_AREA (area));
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
g_return_if_fail (natural_size != NULL);
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_padding (context, state, &border);
+ gtk_style_context_get_padding (context, &border);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_render_background (context, cr, x, y, w, h);
gtk_render_frame (context, cr, x, y, w, h);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
+ gtk_style_context_get_padding (context, &padding);
x += padding.left;
y += padding.top;
/* draw clip region */
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- gtk_style_context_get_color (context,
- gtk_style_context_get_state (context),
- &color);
+ gtk_style_context_get_color (context, &color);
dx = width / 2;
dy = height / 2;
radius = MIN (width / 2, height / 2);
if (priv->calc_fixed_height)
{
GtkStyleContext *style_context;
- GtkStateFlags state;
PangoContext *context;
PangoFontMetrics *metrics;
PangoFontDescription *font_desc;
gint row_height;
style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
- gtk_style_context_get (style_context, state, "font", &font_desc, NULL);
+ gtk_style_context_get (style_context, "font", &font_desc, NULL);
pango_font_description_merge_static (font_desc, priv->font, TRUE);
if (priv->scale_set)
return;
}
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"min-width", width,
"min-height", height,
NULL);
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
context = gtk_cell_renderer_toggle_save_context (cell, widget);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_padding (context, &padding);
+ gtk_style_context_get_border (context, &border);
calc_indicator_size (context, priv->indicator_size, &calc_width, &calc_height);
calc_width += xpad * 2 + padding.left + padding.right + border.left + border.right;
cell_area->y + y_offset + ypad,
width, height);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_padding (context, &padding);
+ gtk_style_context_get_border (context, &border);
if (priv->radio)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context,
- gtk_style_context_get_state (context),
&color);
G_GNUC_END_IGNORE_DEPRECATIONS
100);
gtk_style_context_get (context,
- gtk_style_context_get_state (context),
"font-size", &font_size,
NULL);
font_size = font_size * resolution / 72.0 + 0.5;
if (lines->len > 0)
{
- GtkStateFlags state;
cairo_path_t *path;
GtkBorder border;
GdkRGBA border_color;
cairo_append_path (cr, path);
cairo_path_destroy (path);
- state = gtk_style_context_get_state (context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_border_color (context, state, &border_color);
+ gtk_style_context_get_border_color (context, &border_color);
G_GNUC_END_IGNORE_DEPRECATIONS
- gtk_style_context_get_border (context, state, &border);
+ gtk_style_context_get_border (context, &border);
cairo_set_line_width (cr, border.left);
gdk_cairo_set_source_rgba (cr, &border_color);
GTK_CSS_PROPERTY_DPI),
100);
gtk_style_context_get (context,
- gtk_widget_get_state_flags (treeview),
"font-size", &font_size,
NULL);
pango_attr_list_insert (attrs, attribute);
gtk_style_context_save_to_node (context, link->cssnode);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &link_color);
+ gtk_style_context_get_color (context, &link_color);
gtk_style_context_restore (context);
attribute = pango_attr_foreground_new (link_color.red * 65535,
context = gtk_widget_get_style_context (widget);
gtk_style_context_get_padding (context,
- gtk_style_context_get_state (context),
padding);
}
context = gtk_widget_get_style_context (widget);
gtk_style_context_get_margin (context,
- gtk_style_context_get_state (context),
margin);
}
NULL);
context = gtk_widget_get_style_context (parent);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &parent_padding);
+ gtk_style_context_get_padding (context, &parent_padding);
context = gtk_widget_get_style_context (priv->submenu);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &menu_padding);
+ gtk_style_context_get_padding (context, &menu_padding);
g_object_set (priv->submenu,
"anchor-hints", (GDK_ANCHOR_FLIP_X |
context = gtk_widget_get_style_context (widget);
gtk_style_context_get_margin (context,
- gtk_style_context_get_state (context),
border);
}
gint border_radius;
GtkStyleContext *context;
GtkBorder margin, border, widget_margin;
- GtkStateFlags state;
gtk_popover_get_pointing_to (popover, &rect);
gtk_widget_get_allocation (widget, &allocation);
widget_margin.bottom = gtk_widget_get_margin_bottom (widget);
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_border (context, state, &border);
+ gtk_style_context_get_border (context, &border);
gtk_style_context_get (context,
- state,
GTK_STYLE_PROPERTY_BORDER_RADIUS, &border_radius,
NULL);
pos = get_effective_position (popover, priv->final_position);
gint initial_x, initial_y, final_x, final_y;
gint gap_start, gap_end;
GtkPositionType gap_side;
- GtkStateFlags state;
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
gtk_widget_get_allocation (widget, &allocation);
- gtk_style_context_get_border (context, state, &border);
+ gtk_style_context_get_border (context, &border);
gtk_popover_get_rect_coords (popover,
&rect_x, &rect_y,
&rect_w, &rect_h);
if (border.bottom > 0)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_border_color (context, state, &border_color);
+ gtk_style_context_get_border_color (context, &border_color);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_popover_apply_tail_path (popover, cr);
GtkBorder *border)
{
GtkStyleContext *context;
- GtkStateFlags state;
gint border_width;
GtkBorder tmp;
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- gtk_style_context_get_padding (context, state, border);
- gtk_style_context_get_border (context, state, &tmp);
+ gtk_style_context_get_padding (context, border);
+ gtk_style_context_get_border (context, &tmp);
border->top += tmp.top + border_width;
border->right += tmp.right + border_width;
border->bottom += tmp.bottom + border_width;
get_border_radius (GtkWidget *widget)
{
GtkStyleContext *context;
- GtkStateFlags state;
gint border_radius;
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get (context, state,
+ gtk_style_context_get (context,
GTK_STYLE_PROPERTY_BORDER_RADIUS, &border_radius,
NULL);
return border_radius;
}
context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
pos_x = (width - w) / 2;
pos_y = (height - h) / 2 - 10;
context = gtk_widget_get_style_context (widget);
/* Size based on characters and the icon size */
- gtk_style_context_get (context, gtk_style_context_get_state (context), "font-size", &font_size, NULL);
+ gtk_style_context_get (context, "font-size", &font_size, NULL);
width = impl->priv->icon_size + font_size * NUM_CHARS + 0.5;
height = (impl->priv->icon_size + font_size) * NUM_LINES + 0.5;
{
GtkWidget *widget = GTK_WIDGET (revealer);
GtkStyleContext *context;
- GtkStateFlags state;
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_padding (context, state, padding);
+ gtk_style_context_get_padding (context, padding);
}
static void
return context->priv->cssnode;
}
-static GtkStateFlags
-gtk_style_context_push_state (GtkStyleContext *context,
- GtkStateFlags state)
-{
- GtkStyleContextPrivate *priv = context->priv;
- GtkStateFlags current_state;
- GtkCssNode *root;
-
- current_state = gtk_css_node_get_state (priv->cssnode);
-
- if (current_state == state)
- return state;
-
- root = gtk_style_context_get_root (context);
-
- if (GTK_IS_CSS_TRANSIENT_NODE (priv->cssnode))
- {
- /* don't emit a warning, changing state here is fine */
- }
- else if (GTK_IS_CSS_WIDGET_NODE (root))
- {
- GtkWidget *widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (root));
- g_debug ("State %u for %s %p doesn't match state %u set via gtk_style_context_set_state ()",
- state, gtk_widget_get_name (widget), widget, gtk_css_node_get_state (priv->cssnode));
- }
- else
- {
- g_debug ("State %u for context %p doesn't match state %u set via gtk_style_context_set_state ()",
- state, context, gtk_css_node_get_state (priv->cssnode));
- }
-
- gtk_css_node_set_state (priv->cssnode, state);
-
- return current_state;
-}
-
-static void
-gtk_style_context_pop_state (GtkStyleContext *context,
- GtkStateFlags saved_state)
-{
- gtk_css_node_set_state (context->priv->cssnode, saved_state);
-}
-
/**
* gtk_style_context_new:
*
void
gtk_style_context_get_property (GtkStyleContext *context,
const gchar *property,
- GtkStateFlags state,
GValue *value)
{
- GtkStateFlags saved_state;
GtkStyleProperty *prop;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
return;
}
- saved_state = gtk_style_context_push_state (context, state);
_gtk_style_property_query (prop,
value,
gtk_style_context_query_func,
gtk_css_node_get_style (context->priv->cssnode));
- gtk_style_context_pop_state (context, saved_state);
}
/**
* gtk_style_context_get_valist:
* @context: a #GtkStyleContext
- * @state: state to retrieve the property values for
* @args: va_list of property name/return location pairs, followed by %NULL
*
* Retrieves several style property values from @context for a given state.
*/
void
gtk_style_context_get_valist (GtkStyleContext *context,
- GtkStateFlags state,
va_list args)
{
const gchar *property_name;
gtk_style_context_get_property (context,
property_name,
- state,
&value);
G_VALUE_LCOPY (&value, args, 0, &error);
/**
* gtk_style_context_get:
* @context: a #GtkStyleContext
- * @state: state to retrieve the property values for
* @...: property name /return value pairs, followed by %NULL
*
* Retrieves several style property values from @context for a
*/
void
gtk_style_context_get (GtkStyleContext *context,
- GtkStateFlags state,
...)
{
va_list args;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- va_start (args, state);
- gtk_style_context_get_valist (context, state, args);
+ va_start (args, context);
+ gtk_style_context_get_valist (context, args);
va_end (args);
}
g_signal_emit (context, signals[CHANGED], 0);
- g_object_set_data (G_OBJECT (context), "font-cache-for-get_font", NULL);
-
priv->invalidating_context = NULL;
}
/**
* gtk_style_context_get_color:
* @context: a #GtkStyleContext
- * @state: state to retrieve the color for
* @color: (out): return value for the foreground color
*
* Gets the foreground color for a given state.
**/
void
gtk_style_context_get_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color)
{
GdkRGBA *c;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
gtk_style_context_get (context,
- state,
"color", &c,
NULL);
/**
* gtk_style_context_get_background_color:
* @context: a #GtkStyleContext
- * @state: state to retrieve the color for
* @color: (out): return value for the background color
*
* Gets the background color for a given state.
**/
void
gtk_style_context_get_background_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color)
{
GdkRGBA *c;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
gtk_style_context_get (context,
- state,
"background-color", &c,
NULL);
/**
* gtk_style_context_get_border_color:
* @context: a #GtkStyleContext
- * @state: state to retrieve the color for
* @color: (out): return value for the border color
*
* Gets the border color for a given state.
**/
void
gtk_style_context_get_border_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color)
{
GdkRGBA *c;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
gtk_style_context_get (context,
- state,
"border-color", &c,
NULL);
/**
* gtk_style_context_get_border:
* @context: a #GtkStyleContext
- * @state: state to retrieve the border for
* @border: (out): return value for the border settings
*
* Gets the border for a given state as a #GtkBorder.
**/
void
gtk_style_context_get_border (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *border)
{
GtkCssStyle *style;
- GtkStateFlags saved_state;
double top, left, bottom, right;
g_return_if_fail (border != NULL);
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- saved_state = gtk_style_context_push_state (context, state);
style = gtk_style_context_lookup_style (context);
top = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100));
border->left = left;
border->bottom = bottom;
border->right = right;
-
- gtk_style_context_pop_state (context, saved_state);
}
/**
* gtk_style_context_get_padding:
* @context: a #GtkStyleContext
- * @state: state to retrieve the padding for
* @padding: (out): return value for the padding settings
*
* Gets the padding for a given state as a #GtkBorder.
**/
void
gtk_style_context_get_padding (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *padding)
{
GtkCssStyle *style;
- GtkStateFlags saved_state;
double top, left, bottom, right;
g_return_if_fail (padding != NULL);
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- saved_state = gtk_style_context_push_state (context, state);
style = gtk_style_context_lookup_style (context);
top = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_PADDING_TOP), 100));
padding->left = left;
padding->bottom = bottom;
padding->right = right;
-
- gtk_style_context_pop_state (context, saved_state);
}
/**
* gtk_style_context_get_margin:
* @context: a #GtkStyleContext
- * @state: state to retrieve the border for
* @margin: (out): return value for the margin settings
*
* Gets the margin for a given state as a #GtkBorder.
**/
void
gtk_style_context_get_margin (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *margin)
{
GtkCssStyle *style;
- GtkStateFlags saved_state;
double top, left, bottom, right;
g_return_if_fail (margin != NULL);
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- saved_state = gtk_style_context_push_state (context, state);
style = gtk_style_context_lookup_style (context);
top = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_TOP), 100));
margin->left = left;
margin->bottom = bottom;
margin->right = right;
-
- gtk_style_context_pop_state (context, saved_state);
-}
-
-/**
- * gtk_style_context_get_font:
- * @context: a #GtkStyleContext
- * @state: state to retrieve the font for
- *
- * Returns the font description for a given state. The returned
- * object is const and will remain valid until the
- * #GtkStyleContext::changed signal happens.
- *
- * Returns: (transfer none): the #PangoFontDescription for the given
- * state. This object is owned by GTK+ and should not be
- * freed.
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: Use gtk_style_context_get() for "font" or
- * subproperties instead.
- **/
-const PangoFontDescription *
-gtk_style_context_get_font (GtkStyleContext *context,
- GtkStateFlags state)
-{
- GHashTable *hash;
- PangoFontDescription *description, *previous;
-
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
-
- /* Yuck, fonts are created on-demand but we don't return a ref.
- * Do bad things to achieve this requirement */
- gtk_style_context_get (context, state, "font", &description, NULL);
-
- hash = g_object_get_data (G_OBJECT (context), "font-cache-for-get_font");
-
- if (hash == NULL)
- {
- hash = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL,
- (GDestroyNotify) pango_font_description_free);
- g_object_set_data_full (G_OBJECT (context),
- "font-cache-for-get_font",
- hash,
- (GDestroyNotify) g_hash_table_unref);
- }
-
- previous = g_hash_table_lookup (hash, GUINT_TO_POINTER (state));
- if (previous)
- {
- pango_font_description_merge (previous, description, TRUE);
- pango_font_description_free (description);
- description = previous;
- }
- else
- {
- g_hash_table_insert (hash, GUINT_TO_POINTER (state), description);
- }
-
- return description;
}
void
GdkRGBA *pc, *sc;
gtk_style_context_get (context,
- gtk_style_context_get_state (context),
"caret-color", &pc,
"-gtk-secondary-caret-color", &sc,
NULL);
*/
AtkAttributeSet *
_gtk_style_context_get_attributes (AtkAttributeSet *attributes,
- GtkStyleContext *context,
- GtkStateFlags flags)
+ GtkStyleContext *context)
{
GdkRGBA color;
gchar *value;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, flags, &color);
+ gtk_style_context_get_background_color (context, &color);
G_GNUC_END_IGNORE_DEPRECATIONS
value = g_strdup_printf ("%u,%u,%u",
(guint) ceil (color.red * 65536 - color.red),
attributes = add_attribute (attributes, ATK_TEXT_ATTR_BG_COLOR, value);
g_free (value);
- gtk_style_context_get_color (context, flags, &color);
+ gtk_style_context_get_color (context, &color);
value = g_strdup_printf ("%u,%u,%u",
(guint) ceil (color.red * 65536 - color.red),
(guint) ceil (color.green * 65536 - color.green),
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_property (GtkStyleContext *context,
const gchar *property,
- GtkStateFlags state,
GValue *value);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_valist (GtkStyleContext *context,
- GtkStateFlags state,
va_list args);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get (GtkStyleContext *context,
- GtkStateFlags state,
...) G_GNUC_NULL_TERMINATED;
GDK_AVAILABLE_IN_ALL
/* Some helper functions to retrieve most common properties */
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color);
GDK_DEPRECATED_IN_3_16_FOR(gtk_render_background)
void gtk_style_context_get_background_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color);
GDK_DEPRECATED_IN_3_16_FOR(gtk_render_frame)
void gtk_style_context_get_border_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color);
-GDK_DEPRECATED_IN_3_8_FOR(gtk_style_context_get)
-const PangoFontDescription *
- gtk_style_context_get_font (GtkStyleContext *context,
- GtkStateFlags state);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_border (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *border);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_padding (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *padding);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_margin (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *margin);
GDK_DEPRECATED_IN_3_12
/* Accessibility support */
AtkAttributeSet *_gtk_style_context_get_attributes (AtkAttributeSet *attributes,
- GtkStyleContext *context,
- GtkStateFlags flags);
+ GtkStyleContext *context);
G_END_DECLS
selection_node = gtk_text_view_get_selection_node ((GtkTextView *)text_renderer->widget);
gtk_style_context_save_to_node (context, selection_node);
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"color", &fg_rgba,
NULL);
}
else if (text_renderer->state == CURSOR && gtk_widget_has_focus (text_renderer->widget))
{
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"background-color", &fg_rgba,
NULL);
}
cairo_t *cr)
{
GtkStyleContext *context;
- GtkStateFlags state;
GdkRGBA color;
GtkCssNode *text_node;
text_node = gtk_text_view_get_text_node ((GtkTextView *)widget);
gtk_style_context_save_to_node (context, text_node);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_color (context, state, &color);
+ gtk_style_context_get_color (context, &color);
cairo_save (cr);
gtk_style_context_save_to_node (context, selection_node);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &selection);
+ gtk_style_context_get_background_color (context, &selection);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_style_context_restore (context);
GdkRGBA color;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_background_color (context, &color);
G_GNUC_END_IGNORE_DEPRECATIONS
gdk_cairo_set_source_rgba (cr, &color);
context = gtk_widget_get_style_context (widget);
gtk_style_context_get (context,
- gtk_style_context_get_state (context),
- "min-width",
- width, NULL);
-
-
- gtk_style_context_get (context,
- gtk_style_context_get_state (context),
- "min-height",
- height, NULL);
+ "min-width", width,
+ "min-height", height,
+ NULL);
}
static void
style_context = gtk_widget_get_style_context (widget);
gtk_style_context_get_color (style_context,
- gtk_style_context_get_state (style_context),
&color);
gdk_cairo_set_source_rgba (cr, &color);
pango_cairo_show_layout (cr, layout);
GtkTextAttributes *values)
{
GdkRGBA bg_color, fg_color;
- GtkStateFlags state;
-
- state = gtk_style_context_get_state (context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, state, &bg_color);
+ gtk_style_context_get_background_color (context, &bg_color);
G_GNUC_END_IGNORE_DEPRECATIONS
- gtk_style_context_get_color (context, state, &fg_color);
+ gtk_style_context_get_color (context, &fg_color);
values->appearance.bg_color.red = CLAMP (bg_color.red * 65535. + 0.5, 0, 65535);
values->appearance.bg_color.green = CLAMP (bg_color.green * 65535. + 0.5, 0, 65535);
if (values->font)
pango_font_description_free (values->font);
- gtk_style_context_get (context, state, "font", &values->font, NULL);
+ gtk_style_context_get (context, "font", &values->font, NULL);
}
cairo_surface_t *
priv = text_view->priv;
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_padding (context, &padding);
+ gtk_style_context_get_border (context, &border);
padding.left += border.left;
padding.right += border.right;
padding.top += border.top;
{
GtkStyleContext *context;
GdkRGBA bg_color, fg_color;
- GtkStateFlags state;
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
- state = gtk_style_context_get_state (context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, state, &bg_color);
+ gtk_style_context_get_background_color (context, &bg_color);
G_GNUC_END_IGNORE_DEPRECATIONS
- gtk_style_context_get_color (context, state, &fg_color);
+ gtk_style_context_get_color (context, &fg_color);
values->appearance.bg_color.red = CLAMP (bg_color.red * 65535. + 0.5, 0, 65535);
values->appearance.bg_color.green = CLAMP (bg_color.green * 65535. + 0.5, 0, 65535);
if (values->font)
pango_font_description_free (values->font);
- gtk_style_context_get (context, state, "font", &values->font, NULL);
+ gtk_style_context_get (context, "font", &values->font, NULL);
}
static void
GdkRGBA color;
cairo_set_line_width (cr, 1.0);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
gdk_cairo_set_source_rgba (cr, &color);
}
break;
{
GdkRGBA color;
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
cairo_save (cr);
gtk_cairo_transform_to_window (cr, GTK_WIDGET (tree_view), tree_view->priv->drag_highlight_window);
if (tree_view->priv->drag_column_window_state == DRAG_COLUMN_WINDOW_STATE_ORIGINAL)
style_context = _gtk_widget_get_style_context (widget);
gtk_style_context_get (style_context,
- gtk_style_context_get_state (style_context),
"font", &font_desc,
NULL);
GtkBorder d = { 0 };
GtkBorder margin;
GtkStyleContext *context;
- GtkStateFlags s;
GtkCssValue *shadows;
*shadow_width = border;
context = _gtk_widget_get_style_context (GTK_WIDGET (window));
gtk_style_context_save_to_node (context, priv->decoration_node);
- s = gtk_style_context_get_state (context);
/* Always sum border + padding */
- gtk_style_context_get_border (context, s, &border);
- gtk_style_context_get_padding (context, s, &d);
+ gtk_style_context_get_border (context, &border);
+ gtk_style_context_get_padding (context, &d);
sum_borders (&d, &border);
/* Calculate the size of the drop shadows ... */
if (priv->type != GTK_WINDOW_POPUP)
{
/* ... and compare it to the margin size, which we use for resize grips */
- gtk_style_context_get_margin (context, s, &margin);
+ gtk_style_context_get_margin (context, &margin);
max_borders (&border, &margin);
}
context = _gtk_widget_get_style_context (widget);
gtk_style_context_save_to_node (context, priv->decoration_node);
- gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &border);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &tmp);
+ gtk_style_context_get_margin (context, &border);
+ gtk_style_context_get_border (context, &tmp);
sum_borders (&border, &tmp);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &tmp);
+ gtk_style_context_get_padding (context, &tmp);
sum_borders (&border, &tmp);
gtk_widget_style_get (widget,
"decoration-resize-handle", &handle,
{
GtkBorder padding, border;
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_padding (context, &padding);
+ gtk_style_context_get_border (context, &border);
sum_borders (&border, &padding);
gtk_render_background (context, cr,
diff = maximum - minimum;
context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
cairo_set_line_width (cr, 1.0);
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad);
+ gtk_style_context_get_padding (context, &pad);
gtk_style_context_restore (context);
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad);
+ gtk_style_context_get_padding (context, &pad);
gtk_style_context_restore (context);
context = gtk_widget_get_style_context (frame);
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad);
+ gtk_style_context_get_padding (context, &pad);
gtk_style_context_restore (context);
/* Spin to control xthickness */
/* Get the color. This should be initialized by the theme and not be
* the default. */
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &before);
+ gtk_style_context_get_color (context, &before);
/* Add a style that sets a different color for this widget.
* This style has a higher priority than fallback, but a lower
g_object_unref (provider);
/* Get the color again. */
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &after);
+ gtk_style_context_get_color (context, &after);
/* Because the style we added does not influence the color,
* the before and after colors should be identical. */
data = "* { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"window > button { color: #000 }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
".button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
".button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"window button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"window .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"#mywindow .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"window#mywindow .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"window button.button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"window:active .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
g_object_unref (provider);
gtk_style_context_set_path (context, path);
gtk_widget_path_free (path);
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"color", &color,
"background-color", &bg_color,
"font", &font,
/* When style providers are added to the screen as well as the style context
the one specific to the style context should take priority */
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
GTK_STYLE_PROVIDER_PRIORITY_USER);
gdk_rgba_parse (&ref_color, "blue");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
GTK_STYLE_PROVIDER_PRIORITY_USER);
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
GTK_STYLE_PROVIDER_PRIORITY_USER);
gdk_rgba_parse (&ref_color, "blue");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
GTK_STYLE_PROVIDER_PRIORITY_USER);
gdk_rgba_parse (&ref_color, "green");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
gdk_rgba_parse (&ref_color, "green");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}